﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GameSchool.DAL;
using GameSchool.Models;
using GameSchool.ViewModels.Store;

namespace GameSchool.Controllers
{
    public class StoreController : Controller
    {
        private IStoreRepository m_rep;

        public StoreController()
        {
            m_rep = new StoreRepository(new gsEntities());
        }

        public StoreController(IStoreRepository rep)
        {
            m_rep = rep;
        }

        [Authorize(Roles = "Nemandi")]
        public ActionResult Index()
        {
            return RedirectToAction("List");
        }

        [Authorize(Roles = "Nemandi")]
        public ActionResult List()
        {
            var viewModel = new ListViewModel();
            viewModel.items = m_rep.GetItems();

            return View(viewModel);
        }

        [Authorize(Roles = "Nemandi")]
        public ActionResult Buy()
        {
            return View();
        }
    }
}
